import React, {useEffect, useState} from 'react'
import BatchUpload from '@/components/BatchUpload'
import {getData, getImportDDlist, postImportDDlist} from '@/service/order/index'

function DDID(props: any) {
	const {info, sunchange, getOrderList} = props
	const [importDriverId, setImportDriverId] = useState(false) // 导入滴滴非滴滴司机ID
	useEffect(() => {
		setImportDriverId(info)
	}, [info])
	const childCange = (value: any) => {
		if (sunchange) {
			sunchange(value)
		}
	}
	// const [fileObj, setFileObj] = useState<any>()
	const column = [
		{
			title: '订单编号',
			dataIndex: 'orderCarNo',
			align: 'center',
			key: 'orderCarNo',
			width: 200,
		},
		{
			title: '司机名称',
			dataIndex: 'driverName',
			align: 'center',
			key: 'driverName',
			width: 100,
		},
		{
			title: '车牌号',
			dataIndex: 'plateNo',
			align: 'center',
			key: 'plateNo',
			width: 100,
		},
		{
			title: '非滴滴司机ID',
			dataIndex: 'platformDriverNo',
			align: 'center',
			key: 'platformDriverNo',
			width: 100,
		},
		{
			title: '状态',
			dataIndex: 'resultMsg',
			align: 'center',
			key: 'resultMsg',
			width: 200,
			fixed: 'right',
		},
	]
	return (
		<BatchUpload
			isModalOpen={importDriverId}
			setIsModalOpen={setImportDriverId}
			importData={getImportDDlist} // 导入接口
			onTableList={getData} // 获取列表数据-失败
			getListData={getOrderList} // 获取列表数据-成功
			columns={column}
			sourceId={35}
			templateType="导入非滴滴司机ID"
			uploadFileUrl={postImportDDlist} // 文件上传接口
			title="导入非滴滴司机ID"
			childCange={childCange}
			width={800}
		/>
	)
}

export default DDID
